package cn.anlucky.apiadmin.controller;


import cn.anlucky.apiadmin.pojo.Webinfo;
import cn.anlucky.apiadmin.service.WebinfoService;
import cn.anlucky.apiadmin.vo.R;
import cn.dev33.satoken.annotation.SaIgnore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/admin/web")
public class WebInfoController {

    @Autowired
    private WebinfoService webinfoService;

    /**
     * 取网页全局信息
     * @return
     */
    @SaIgnore// 游客可以访问
    @GetMapping("/info")
    public R getWebInfo(){
        R webInfo = webinfoService.getWebInfo();
        return webInfo;
    }

    /**
     * 更新网页信息
     * @param webinfo
     * @return
     */
    @PostMapping("/updateInfo")
    public R updateInfo(@RequestBody Webinfo webinfo){
        R r = webinfoService.updateWebInfoById(webinfo);
        return r;
    }



}
